package yunquan.wang.modules.base.service.impl;
//package com.zidei.moudle.core.service.impl;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import javax.annotation.Resource;
//
//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import com.zidei.core.cache.ZideiCache;
//import com.zidei.core.web.TreePojo;
//import com.zidei.moudle.core.entity.Company;
//import com.zidei.moudle.core.entity.Department;
//import com.zidei.moudle.core.entity.Organization;
//import com.zidei.moudle.core.entity.UserBasic;
//import com.zidei.moudle.core.service.OrganizationService;
//
//@Service
//@Transactional(value = "jpaTransaction")
//public class SystemService {
//	protected Log logger = LogFactory.getLog(this.getClass());
//	@Resource
//	private OrganizationService organizationService;
//	@Resource
//	private ZideiCache orgCache;
//
//	/**
//	 * 获取组织结构树实现
//	 */
//	public List<TreePojo> getOrgTree(final int level) {
//		List<TreePojo> list = new ArrayList<TreePojo>();
//		List<Organization> orgList = organizationService.getAllIninOrg();
//		TreePojo root = new TreePojo("1", "0", "组织机构");
//		root.setOpen(true);
//		list.add(root);
//		for (Organization org : orgList) {
//			root = new TreePojo(org.getId(), "1", org.getShortname());
//			root.setOpen(true);
//			list.add(root);
//			if (level > 0) {
//				for (Company compa : org.getCompanys()) {
//					root = new TreePojo(compa.getId(), org.getId(),	compa.getName());
//					list.add(root);
//					if (level > 1) {
//						for (Department de : compa.getDepartments()) {
//							root = new TreePojo(de.getId(), compa.getId(),
//									de.getName());
//							list.add(root);
//							if (level > 2) {
////								for (UserBasic user : de.getUserBasics()) {
////									root = new TreePojo(user.getId(),
////											de.getId(), user.getName());
////									list.add(root);
////								}
//							}
//						}
//					}
//				}
//			}
//		}
//		for (TreePojo obj : list) {
//			logger.debug(obj);
//		}
//		return list;
//	}
//
//}
